<?php
class OnlineQuestionDao {
	public $table = 'online_question';
	public function add($data){
		ClassManager::getSql()->insert($this->table, $data);
	}
	public function update($data,$id){
		ClassManager::getSql()->updates($this->table, $data,"where id=".intval($id));
	}
	public function get($id){
		return ClassManager::getSql()->oneDataCache($this->table, 'id',intval($id));
	}
	public function searchList($where=array(),$order,$limit=0){
		$where = $this->searchWhere($where);
		return ClassManager::getSql()->dataList1($this->table,'*',$where,$order,$limit);
	}
	public function searchNumber($where){
		$where = $this->searchWhere($where);
		$tmp = ClassManager::getSql()->onedata1($this->table,"count(*)  ",$where);
		return $tmp[0];
	}
	public function searchWhere($where){
		foreach ($where as  $k=>$v){
			if (!empty($v)){
				$where1[$k] =  $v;
			}
		}
		return $where1;
	}
	public function deleteBatchByid($id){
		ClassManager::getSql()->delete($this->table,"where id in(".$id.")");
	}
}
?>